<div class="pageContent">
    <form method="post"
        action="${rc.getContextPath()}/manage/maintainStrategy/saveStrategy"
        class="pageForm required-validate"
        onsubmit="return validateCallback(this, dialogAjaxDone);">
        <div class="pageFormContent">
            <input type="hidden" name="navTabId" value="${navTabId!''}">
            <input type="hidden" name="id"
                value="<#if (strategy.strategyCode)??>${strategy.strategyCode!''}</#if>">
            <fieldset class="dataset">
                <dl>
                    <dt><@label key="strategyCode.C,colon">维护策略编号：</@label></dt>
                    <dd>
                        <input name="strategyCode"
                            value="<#if (strategy.strategyCode)??>${strategy.strategyCode!''}</#if>"
                            size="32" type="text" maxlength="20" class="required alphanumeric toUp"<#if
                        (strategy.strategyCode)??> readonly="readonly"<#else>
                        remote="${rc.getContextPath()}/manage/maintainStrategy/validateStrategyCode"</#if> warn="<@label key="strategyCodeExist.M">维护策略编号已经存在</@label>"
                        /> 
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="strategyText.C,colon">维护策略描述：</@label></dt>
                    <dd>
                        <input name="strategyText"
                            value="<#if (strategy.strategyText)??>${strategy.strategyText!''}</#if>"
                            size="32" type="text" maxlength="60" class="required" />
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="strategyTypeECode.C,colon">策略类型：</@label></dt>
                    <dd>
                        <select <#if
                        (strategy.strategyCode)??> disabled</#if> id="strategyTypeECode" name="strategyTypeECode">
                        <#list strategyType as types>
                        <option value="${types.eCode}"<#if strategy.strategyTypeECode?? && strategy.strategyTypeECode == types.eCode> selected="selected"</#if>>${types.eCodeText}</option> </#list>
                </select>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="strategyCountValue.C,colon">损耗点：</@label></dt>
                    <dd>
                    <input id="strategyCountValue" name="strategyCountValue"
                            value="<#if (strategy.strategyCountValue)??>${strategy.strategyCountValue!''}</#if>"
                            size="32" type="text" min="1" maxlength="10" class="digits"/>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="strategyTimeValue.C,colon">周期：</@label></dt>
                    <dd>
                    <input id="strategyTimeValue" name="strategyTimeValue"
                            value="<#if (strategy.strategyTimeValue)??>${strategy.strategyTimeValue!''}</#if>"
                            size="32" type="text" min="1" maxlength="10" class="digits" />
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="timeUnitECode.C,colon">周期单位：</@label></dt>
                    <dd>
                        <select id="timeUnitECode" name="timeUnitECode" class="required">
                        <#list timeUnit as types>
                        <option value="${types.eCode}"<#if strategy.timeUnitECode?? && strategy.timeUnitECode == types.eCode> selected="selected"</#if>>${types.eCodeText}</option> </#list>
                </select>
                    </dd>
                </dl>
                <dl style="height:70px;width:600px">
                    <dt><@label key="memo.C,colon">备注：</@label></dt>
                    <dd>
                        <textarea style="width:435px;height:68px;" maxlength="200" name="memo" cols="45" rows="4"><#if (strategy.memo)??>${strategy.memo!''}</#if></textarea>
                    </dd>
                </dl>
                <dl>
                    <dt>&nbsp;</dt>
                    <dd>
                        <label><input type="checkbox" name="lockFlag" value="1"<#if
                            (strategy.lockFlag)?? && (strategy.lockFlag == 1)>
                            checked="true"</#if>><@label key="lock.C">锁定</@label></label>
                    </dd>
                </dl>
            </fieldset>
        </div>
        <#if (strategy.strategyCode)??> 
            <#assign createInfo=strategy/>
            <#include "/common/createInfo.html">
        </#if>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit"><@label key="save.B">保存</@label></button>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="buttonActiveGrey">
                        <div class="buttonContent">
                            <button type="button" class="close"><@label key="cancel.B">取消</@label></button>
                        </div>
                    </div></li>
            </ul>
        </div>
    </form>
</div>

<script type="text/javascript">
$(function() {
    setRequired();
    function setRequired()
    {
        var s=$('#strategyTypeECode',$.pdialog.getCurrent()).children('option:selected').val();
        if(s=="CYCLE")
        {
            $('#strategyTimeValue',$.pdialog.getCurrent()).addClass("required");
            $('#timeUnitECode',$.pdialog.getCurrent()).addClass("required");
               $('#strategyCountValue',$.pdialog.getCurrent()).removeClass("required");
               $('#strategyCountValue',$.pdialog.getCurrent()).attr('disabled','disabled');
               $('#strategyTimeValue',$.pdialog.getCurrent()).removeAttr('disabled');
               $('#timeUnitECode',$.pdialog.getCurrent()).removeAttr('disabled');
        }
        else
        {
            $('#strategyTimeValue',$.pdialog.getCurrent()).removeClass("required");
            $('#timeUnitECode',$.pdialog.getCurrent()).removeClass("required");
               $('#strategyCountValue',$.pdialog.getCurrent()).addClass("required");
            $('#strategyCountValue',$.pdialog.getCurrent()).removeAttr('disabled');
            $('#strategyTimeValue',$.pdialog.getCurrent()).attr('disabled','disabled');
            $('#timeUnitECode',$.pdialog.getCurrent()).attr('disabled','disabled');
        }
    }
$('#strategyTypeECode',$.pdialog.getCurrent()).change(function(){ 
    setRequired();
    }) 
});
</script>